<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Break : Continue</title></head>
<body bgcolor="#FFFFDF" link="#009999" vlink="#006666" alink="#006666">
<font face="Arial" size="2"><p align="center"><b><font size="5">Break : Continue</font></b></p>

<br><b>Syntax</b><blockquote><pre><font face="Courier New, Courier, mono"size="2"><b><font color="#006666">Break</font></b> [Level]
</font></pre></blockquote>
<b>Description</b><br><blockquote>


<b><font color="#006666">Break</font></b> provides the ability to exit during any iteration, for the following loops: 
<a href="../reference/repeat_until.html">Repeat</a>, <a href="../reference/for_next.html">For</a>, <a href="../reference/foreach_next.html">ForEach</a> and <a href="../reference/while_wend.html">While</a>. 
The optional 'level' parameter specifies the number of loops to exit from, given several nested loops. 
If no parameter is given, <b><font color="#006666">Break</font></b> exits from the current loop. 

 

</blockquote><p><b>Example:</b> Simple loop</p><blockquote>


<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#006666">For</font></b> k=0 <b><font color="#006666">To</font></b> 10
    <b><font color="#006666">If</font></b> k=5
      <b><font color="#006666">Break</font></b>  <font color="#006666">; Will exit directly from the For/Next loop</font>
    <b><font color="#006666">EndIf</font></b>
    <b><font color="#006666">Debug</font></b> k
  <b><font color="#006666">Next</font></b>
</font></pre>

</blockquote><p><b>Example:</b> Nested loops</p><blockquote>


<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#006666">For</font></b> k=0 <b><font color="#006666">To</font></b> 10
    Counter = 0
    <b><font color="#006666">Repeat</font></b>
      <b><font color="#006666">If</font></b> k=5
        <b><font color="#006666">Break</font></b> 2 <font color="#006666">; Will exit directly from the Repeat/Until and For/Next loops</font>
      <b><font color="#006666">EndIf</font></b>
      Counter+1
    <b><font color="#006666">Until</font></b> Counter &gt; 1
    <b><font color="#006666">Debug</font></b> k
  <b><font color="#006666">Next</font></b>
</font></pre>


</blockquote>
<br><b>Syntax</b><blockquote><pre><font face="Courier New, Courier, mono"size="2"><b><font color="#006666">Continue</font></b>
</font></pre></blockquote>
<b>Description</b><br><blockquote>


<b><font color="#006666">Continue</font></b> provides the ability to skip straight to the end of the current iteration 
(bypassing any code in between) in the following loops: 
<a href="../reference/repeat_until.html">Repeat</a>, <a href="../reference/for_next.html">For</a>, <a href="../reference/foreach_next.html">ForEach</a>, and <a href="../reference/while_wend.html">While</a>. 

 

</blockquote><p><b>Example</b></p><blockquote>


<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#006666">For</font></b> k=0 <b><font color="#006666">To</font></b> 10
    <b><font color="#006666">If</font></b> k=5
      <b><font color="#006666">Continue</font></b>  <font color="#006666">; Will skip the 'Debug 5' and go directly to the next iteration</font>
    <b><font color="#006666">EndIf</font></b>
    <b><font color="#006666">Debug</font></b> k
  <b><font color="#006666">Next</font></b>
</font></pre>
</body></html>